//
//  BalanceCell.m
//  Cat
//
//  Created by lushitong on 2019/1/9.
//  Copyright © 2019年 lushitong. All rights reserved.
//

#import "BalanceCell.h"
#import "BalancelModel.h"

@interface BalanceCell()

@property (nonatomic, strong) UILabel *topLeftLable;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *rightInfoLabel;

@end

@implementation BalanceCell

- (void)setCellModelData:(id)cellModelData {
	if ([cellModelData isKindOfClass:[BalancelModel class]]) {
		BalancelModel *model = (BalancelModel *)cellModelData;
		self.topLeftLable.text = model.title;
		self.timeLabel.text = model.createTime;
		self.rightInfoLabel.text = model.amount;
	}
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
	self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
	if (self) {
		self.cellSeparatorStyle = QKUITableViewCellSeparatorStyleSingleLineBottomZero;
		self.selectionStyle = UITableViewCellSelectionStyleNone;
		[self loadSubviews];
	}
	return self;
}

- (void)loadSubviews {
	[self.contentView addSubviews:@[self.topLeftLable,self.timeLabel,self.rightInfoLabel]];
	
	[self.topLeftLable mas_makeConstraints:^(MASConstraintMaker *make) {
		make.left.equalTo(self.contentView.mas_left).offset(kQKFitModuleDecimal(16.0));
		make.top.equalTo(self.contentView.mas_top).offset(kQKFitModuleDecimal(14.0));
	}];
	
	[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
		make.left.equalTo(self.topLeftLable.mas_left);
		make.bottom.equalTo(self.contentView.mas_bottom).offset(-kQKFitModuleDecimal(12.0));
	}];
	
	[self.rightInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
		make.centerY.equalTo(self.contentView.mas_centerY);
		make.right.equalTo(self.contentView.mas_right).offset(-kQKFitModuleDecimal(27));
	}];
}

#pragma mark----- lazy init -----

- (UILabel *)topLeftLable {
	if (!_topLeftLable) {
		_topLeftLable = [UILabel labelWithFont:[UIFont boldSystemFontOfSize:kQKFitFont(14)] textColor:COLOR_WITH_HEX(0x4C4947)];
		_topLeftLable.text = @"2018年7月份收益结算";
	}
	return _topLeftLable;
}


- (UILabel *)timeLabel {
	if (!_timeLabel) {
		_timeLabel = [UILabel labelWithFont:[UIFont systemFontOfSize:kQKFitFont(10)] textColor:COLOR_WITH_HEX(0xCDC7C4)];
		_timeLabel.text = @"2018.06.03 09:00";
	}
	return _timeLabel;
}

- (UILabel *)rightInfoLabel {
	if (!_rightInfoLabel) {
		_rightInfoLabel = [UILabel labelWithFont:[UIFont systemFontOfSize:kQKFitFont(14)] textColor:COLOR_WITH_HEX(0x57524F)];
		_rightInfoLabel.text = @"-￥100";
	}
	return _rightInfoLabel;
}

@end
